<?php 
include("simple-php-captcha.php");
$_SESSION['captcha'] = captcha();

$code=$_SESSION['captcha']['code'];


?>
<script type="text/javascript">
$(document).ready(function(){
	document.getElementById("email").focus();
});
function checkEmail(str)
{
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("checkemail").innerHTML=xmlhttp.responseText;
										  }
									  }
	xmlhttp.open("GET","ajax/checkEmailsignup.php?value="+str,true);
	xmlhttp.send();
}
function checkEmail2()
{
	var str=document.getElementById('email').value;
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("checkemail").innerHTML=xmlhttp.responseText;
										  }
									  }
	xmlhttp.open("GET","ajax/checkEmailsignup.php?value="+str,true);
	xmlhttp.send();
}
function checkEmail1()
{
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("checkemail").innerHTML=xmlhttp.responseText;
										  }
									  }
	xmlhttp.open("GET","ajax/checkEmailsignup.php",true);
	xmlhttp.send();
}

function checkPass(str)
{
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("checkpass").innerHTML=xmlhttp.responseText;
										  }
									  }
	xmlhttp.open("GET","ajax/checkPasssignup.php?value="+str,true);
	xmlhttp.send();
}

function checkcPass(str)
{
	var pass=document.getElementById('pass').value;
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("checkcpass").innerHTML=xmlhttp.responseText;
										  }
									  }
	xmlhttp.open("GET","ajax/checkcPasssignup.php?cpass="+str+"&pass="+pass,true);
	xmlhttp.send();
}
function enterTable(e,value){
    var key = window.event ? e.keyCode : e.which;
    if(key==13){
		var j = 0;
		var listID = new Array();
		listID = listID.concat(["email","pass","cpass","captchai"]);	
		for (j = 0; j < listID.length; j++){	
			if (listID[j] == value) {	
				if (j == listID.length - 1) {
					return false;
				}
				document.getElementById(listID[j + 1]).focus();
				document.getElementById(listID[j + 1]).select();
				return false; 
			}
		}
		
		return false;
	}else
		return true;	
				
}
</script>

    <div class="maincon1">
        <div class="dnbox">
            <h2><?=$signup1?></h2>
            <p><?=$signup2?></p>
        </div>
    </div>
    <div class="maind">
    	<div class="mainleft" style="width: 350px;">

        	<div class="formlh" id="fsignup">
        		
        		<form action="index.php" method="post">
        		
            	<p><span style="font-weight: bold;"><?=$email?></span><input name="email" id="email" onkeypress="return enterTable(event,this.id);" type="text" onfocus="checkEmail1()"  onchange="checkEmail(this.value)" value="<?=$nemail?>" autocomplete="off"/>(*)</p>
            	<div id="checkemail">
            	</div>
                <p><span style="font-weight: bold;"><?=$namepasswd?></span><input name="passwd" type="password" id="pass" onkeypress="return enterTable(event,this.id);" onfocus="checkEmail2()" onchange="checkPass(this.value)"/>(*)</p>
                <div id="checkpass">
            	</div>
                <p><span style="font-weight: bold;"><?=$cpasswd?></span><input name="cpasswd" type="password" id="cpass" onkeypress="return enterTable(event,this.id);" onfocus="checkEmail2()" onchange="checkcPass(this.value)" />(*)</p>
                <div id="checkcpass">
            	</div>
                <!-- p><span style="font-weight: bold;"><?=$email2?></span><input name="emailrestore" type="text" /></p-->
                <p id="captcha"><span style="font-weight: bold;"></span><input type="hidden" name="code" value="<?=$code?>"><?php echo '<img   src="' . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA" style="width:150px;height:35px; margin: 0 0 -13px;" />';?><img onclick="changeCaptcha()"  src="images/f5.png" style="margin:0 0 -13px 15px"/></p>
                <p><span style="font-weight: bold;"><?=$captcha1?></span><input type="text" name="captcha" autocomplete="off" id="captchai" onfocus="checkEmail2()"  />(*)</p>
                <p style="text-align:right;"><input style="margin: 0px 20px 0 0;" type="submit" name="signup" value="<?=$signup?>" class="btsub"  /></p>
                </form>
                <?php if(isset($_SESSION['errordk'])){?>
        		<p ><span></span><span style="color: red;width: auto;font-size: 12px">(*)<?php	echo $_SESSION['errordk']; session_unregister('errordk');?></span></p>
        		<?php }?>
            </div>

                
            </div>
       
        <div class="mainright" style="width: 588px;">
        	<p> <img src="images/tk.png"/><h3 ><?=$account?></h3> </p>
            <p style="padding:10px 0 5px 30px; line-height: 24px;"><img src="images/arrow.png" style="width:16px; height:16px; padding:0px 5px 0px 5px; margin:0px 0px 0px 0px" /><?=$login2?></p>
            <!--p style="padding:10px 0 5px 30px; line-height: 24px;"><img src="images/arrow.png" style="width:16px; height:16px; padding:0px 5px 0px 5px; margin:0px 0px 0px 0px" /><?=$login3?></p-->
            
              
            </div>
  </div>
        <div class="clear"></div>

    